﻿using UnityEngine;
using UnityEngine.SceneManagement;
using System.Diagnostics;
using System.Collections;

public class mainScene : MonoBehaviour
{
    public float movieTime;
    public string quitScene;
    public string nextScene;
    MediaPlayerCtrl m_Media = new MediaPlayerCtrl();
    Stopwatch time = new Stopwatch();

    // Use this for initialization
    void Start()
    {
        m_Media = GameObject.FindGameObjectWithTag("video").GetComponent<MediaPlayerCtrl>();
    }

    // Update is called once per frame
    void Update()
    {
        if (time.ElapsedMilliseconds >= movieTime * 1000)
        {
            time.Stop();
            SceneManager.LoadScene(nextScene);
        }
    }

    public void Play()
    {
        GameObject.Find("Button").SetActive(false);
        m_Media.Play();
        time.Start();
    }

    public void Quit()
    {
        SceneManager.LoadScene(quitScene);
    }
}
